package com.booth.manage.controllers;

import com.booth.base.controllers.BaseController;
import com.booth.base.model.Users;
import com.booth.base.utils.ResultStatus;
import com.booth.manage.model.BoothProgress;
import com.jfinal.plugin.activerecord.Page;

/***
 * 摊位申请控制器
 * @author admin
 *
 */
public class BoothMyController extends BaseController {
	private boolean success = false;
	
	private final static String BASE_PAGE_URL = "booth_my";

	/***
	 * 进入列表页
	 */
	public void index() {
		render(BASE_PAGE_URL+"_index.jsp");
	}


	/***
	 * 获取列表页数据
	 */
	public void list() {
		String progressName = getPara("progressName");
		String progressStatus = getPara("progressStatus");
		String createStartTime = getPara("createStartTime");
		String createEndTime = getPara("createEndTime");
		String checkStartTime = getPara("checkStartTime");
		String checkEndTime = getPara("checkEndTime");
		String businessStartTime = getPara("businessStartTime");
		String businessEndTime = getPara("businessEndTime");
		Users curUser = super.getCurUser();
		Integer applyId = Integer.MIN_VALUE;
		if(curUser.getGroupType() != null &&  curUser.getGroupType() == GROUP_TYPE_3) {
			applyId = curUser.getUserId();
		}
		int page = getParaToInt("page", 1);
		int pageSize = getParaToInt("rows", 10);
		Page<BoothProgress> pager = BoothProgress.dao.findPage(page, pageSize,progressName
				,progressStatus,createStartTime,createEndTime,checkStartTime,checkEndTime,businessStartTime,businessEndTime,applyId,0);
		setAttr("total", pager.getTotalRow());
		setAttr("rows", pager.getList());
		renderResult(ResultStatus.SUCCESS);
	}

	

}
